package com.taxue.designpattern.lession107;

import com.taxue.designpattern.lession107.bean.House;
import com.taxue.designpattern.lession107.impl.HouseBuilderImpl;

//建造者模式或者生成器模式
/*
  用来隐藏复合对象的创建过程，它把复合对象的创建
过程加以抽象，通过子类继承和重载的方式，动
态地创建具有复合属性的对象*/


public class MainClass {

	public static void main(String[] args) {
//		//客户直接造房子
		System.out.println("===================客户直接造房子=========================");
		House houseKehu = new House();
		houseKehu.setFloor("地板");
		houseKehu.setWall("墙");
		houseKehu.setHousetop("屋顶");
		
		System.out.println(houseKehu.getFloor());
		System.out.println(houseKehu.getWall());
		System.out.println(houseKehu.getHousetop());
		
		System.out.println("====================设计者来做  由工程队来修==============================");
		//由工程队来修
		HouseBuilder builder = new HouseBuilderImpl();
		//设计者来做
		HouseDirector director = new HouseDirector();
		director.makeHouse(builder);
		House house = builder.getHouse();
		System.out.println(house.getFloor());
		System.out.println(house.getWall());
		System.out.println(house.getHousetop());
	}

}
